<template>
  <div>
    <!-- <Code :data="code.code1" describe>
        <template #title>默认表格</template>
        <template #default>

        </template>
      </Code> -->
    <LeeTable
      :columns="columns"
      url="/users"
      row-key="id"
    />
  </div>
</template>

<script lang="ts">
export default {
  name: 'CodeViewTable',
};
</script>

<script lang="ts" setup>
import { reactive, getCurrentInstance } from 'vue';

getCurrentInstance();
const columns = reactive([
  {
    type: 'selection',
  },
  {
    label: 'id',
    prop: 'id',
  },
  {
    label: 'Date',
    prop: 'date',
    filter: 'parseTime',
    filterParams:['{y}-{m}'],
    sortable: 'custom',
  },
  {
    label: 'Name',
    prop: 'name',
    sortable: 'custom',
  },
]);

const state = reactive({
  tableData: [],
});

state.tableData = Array.from({ length: 10 }).map((item, index) => {
  return {
    id: ++index,
    date: `2022-01-${++index >= 10 ? index : '0' + index}`,
    name: 'Lee',
    address: 'No. 189, Grove St, Los Angeles',
  };
});
</script>

<style lang="scss" scoped>
</style>
